package com.yes.yll.cuize;

import com.yes.yll.JdbcUtils;

import java.util.List;

public class Jdbc {
    public static void main(String[] args) {
        //5.1
        String sql = "SELECT `id`, `name` FROM human WHERE age>=18";
        List<Human> humans = JdbcUtils.selects(sql, Human.class);
        for(Human u:humans){
            System.out.println(u);
        }

        //5.2
        /*String sql = "SELECT `id`, `name` ,age FROM human WHERE `name`='Nano'";
        Human select = JdbcUtils.select(sql, Human.class);
        System.out.println(select);
*/
        //5.3
        /*String sql = "SELECT `id`, `name` ,age FROM human WHERE `name`='NEo' AND age=15";
        Human select = JdbcUtils.select(sql, Human.class);
        System.out.println(select);*/

        //5.4
       /* String sql = "SELECT COUNT(1) FROM `human` WHERE `name` = 'Tom'";
        Boolean c = JdbcUtils.select(sql, Boolean.class);
        System.out.println(c);*/

        //5.5
        /*String sql = "SELECT COUNT(1) FROM `human` WHERE `name` = '少于十岁'";
        Boolean c = JdbcUtils.select(sql, Boolean.class);
        System.out.println(c);*/


        //5.6
       /* String sql = "SELECT COUNT(1) FROM human";
        Long select = JdbcUtils.select(sql, Long.class);
        System.out.println(select);*/

        //5.7
       /* String sql = "SELECT COUNT(1) FROM human WHERE age>=18";
        Long select = JdbcUtils.select(sql, Long.class);
        System.out.println(select);*/



    }
}
